package com.ccs.demo.enums;
import lombok.Getter;

import java.awt.print.Book;

public enum BookStatus {
    DELETE(0,"无效"),
    NORMAL(1,"可借阅"),
    FORBIDDEN(2,"不可借阅");

    @Getter
    private Integer code;
    @Getter
    private String desc;

    BookStatus(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static BookStatus getStatusByCode(Integer code){
        switch(code){
            case 0: return BookStatus.DELETE;
            case 1: return BookStatus.NORMAL;
            case 2: return BookStatus.FORBIDDEN;
            default:
                return null;
        }
    }


//    DELETE(0,"无效"),
//    NORMAL(1,"可借阅"),
//    FORBIDDEN(2,"不可借阅");
//
//    @Getter
//    private int code;
//    @Getter
//    private String desc;
//
//    BookStatus(int code, String desc) {
//        this.code = code;
//        this.desc = desc;
//    }
//
//    public static BookStatus getStatusByCode(Integer code){
//        switch(code){
//            case 0:return BookStatus.DELETE;
//            case 1:return BookStatus.NORMAL;
//            case 2:return BookStatus.FORBIDDEN;
//            default :
//                return null;
//        }
//
//    }



}
